@echo off
REM ============================================
REM Worker Start Script (Windows)
REM ============================================

chcp 65001 >nul

REM Save current directory and change to project root
set SCRIPT_DIR=%~dp0
cd /d "%SCRIPT_DIR%\..\.."

REM Activate virtual environment if exists
if exist "venv\Scripts\activate.bat" (
    call venv\Scripts\activate.bat
    echo [OK] Virtual environment activated
)

REM Set Hugging Face mirror for China users
set HF_ENDPOINT=https://hf-mirror.com

REM Check if config file exists
if not exist "config\worker_config.json" (
    echo [ERROR] Config file not found
    echo Please run: scripts\windows\config_wizard.bat
    pause
    exit /b 1
)

REM Start Worker
echo Starting Worker service...
echo ====================
echo Command: python worker.py %*
echo.
python worker.py %*
